extends ../layout

block meta
    link(rel="stylesheet", href="#{options.cdn_path}/js/artDialog/skins/combo?/js/artDialog/skins/default.css&v=#{options.site_version}")
    link(rel="stylesheet", href="#{options.cdn_path}/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css?v=#{options.site_version}")

block content
    // 传递参数
    accountsClass = true
    include ../common/_admin_navbar
    .content
        .header
            h1.page-title 用户管理
        ul.breadcrumb
            li
                a(href="/admin") 首页
                span.divider /
            li.active 用户管理
        .container-fluid
            .row-fluid
                .btn-toolbar
                    button.btn.btn-primary.info_btn
                        i.icon-save 
                        | &nbsp;保存
                    a.btn(href="/admin/blog/list") 返回
                    .btn-group
                .well
                    #myTabContent.tab-content
                        #info.tab-pane.active
                            form#info_btn(action="/admin/user/update", method="post")
                                img(src="#{userInfo.head_photo}", style="float: right;border-radius: 50%;margin-right: 50%;")
                                label 昵称
                                input.input-xlarge(type="text", name="user.nick_name", value="#{userInfo.nick_name}", required="required")
                                label 性别
                                div(style="margin-bottom: 8px;")
                                    label.checkbox.inline
                                        if userInfo.sex == 0
                                            input(type="radio", name="user.sex", value="0", "checked")
                                        else
                                            input(type="radio", name="user.sex", value="0")
                                        | 女
                                    label.checkbox.inline
                                        if userInfo.sex == 1
                                            input(type="radio", name="user.sex", value="1", "checked")
                                        else
                                            input(type="radio", name="user.sex", value="1")
                                        | 男
                                label 生日
                                .input-append.date.form_datetime
                                    input.input-xlarge(type="text", name="user.birthday", value="#{userInfo.birthday}", readonly)
                                    span.add-on
                                        i.icon-th
                                </div>
                                label 博客（微博）链接
                                input.input-xlarge(type="text", name="user.url", value="#{userInfo.url}")
                                label 个性签名
                                textarea(name="user.signature", rows="3", cols="20", style="width: 500px; height: 100px;") #{userInfo.signature}

                include ../common/_admin_footer

block script
    script(src="#{options.cdn_path}/js/artDialog/jquery.artDialog.min.js?v=#{options.site_version}")
    script(src="#{options.cdn_path}/js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js?v=#{options.site_version}")
    script
        $(function(){
            $('.form_datetime').datetimepicker({
                format: "yyyy-mm-dd",
                autoclose: true,
                todayBtn: true,
                pickerPosition: "bottom-left"
            });
            $('.info_btn').click(function(){
                var dialog = $.dialog();
                _post('#info_btn', dialog, function(data){
                    if(data.status){
                        dialog.content('保存成功！').lock().time(1000);
                        setTimeout(function(){
                            location.href = '/admin/user';
                        }, 1500);
                    }else{
                        dialog.content('服务器忙，请稍候！').time(2000);
                    }
                });
                return false;
            });
        });